Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataConnect + PGLite prototype. #7615

Merged
merged 30 commits into from
Sep 11, 2024
Merged

DataConnect + PGLite prototype. #7615

merged 30 commits into from
Sep 11, 2024

Conversation

joehan
Copy link
Contributor

@joehan joehan commented Aug 31, 2024

Description

Got a working prototype of the DataConnect emualtor backed by PGLite. If you want to use this instead of spinning up your own Postgres, run firebase experiments:enable fdcpglite and the start up the emulator (make sure port 5432 is free!)

Note: Previously, this had some unshippable changes - those have been fixed after the latest commits.

Scenarios Tested

Start up the DataConnect emulator with no Postgres server running beforehand, and then watch it successfully spin up a PGLite database, force migrate it to a simple schema, and then curl the dataplane. I tested this both on a gLinux cloudtop and on my m1 Mac.

TODO Testing

  • Test on Windows
  • Test on Intel mac
  • Test on IDX

@milyes
Copy link

milyes commented Aug 31, 2024

active sync

@joehan joehan marked this pull request as ready for review September 9, 2024 17:32
Comment on lines +69 to +78
// TODO: get peer cert and validate through hook
const isValid = false;

// const isValid = await this.auth.validateCredentials(
// {
// username: this.username,
// certificate: this.socket.getPeerCertificate(),
// },
// this.connectionState,
// );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be handled? (not sure if this is directly copied from pg-gateway or not)

Copy link
Contributor Author

@joehan joehan Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for us to actually authenticate the toolkit's creds - the FDC toolkit is trusted, so we are using 'trust' auth and will never hit this code.

I removed this while debugging some import issues that arose from converting these files to cjs.

src/emulator/dataconnect/pgliteServer.ts Outdated Show resolved Hide resolved
src/emulator/dataconnect/pgliteServer.ts Outdated Show resolved Hide resolved
src/emulator/dataconnect/pgliteServer.ts Outdated Show resolved Hide resolved
@@ -25,6 +26,9 @@ export interface DataConnectEmulatorArgs {
auto_download?: boolean;
rc: RC;
config: Config;
autostartPostgres: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: let's switch this this autoconnectToPostgres, so that it meshes with the DataConnectToolkitRegistry harold is working on.

@joehan joehan changed the base branch from master to launch.fdc-pp September 11, 2024 18:48
Copy link
Contributor

@hlshen hlshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with plans to get rid of pg-gateway folder

@joehan joehan merged commit b8326ae into launch.fdc-pp Sep 11, 2024
17 checks passed
@joehan joehan deleted the jh-pglite branch September 11, 2024 21:19
joehan added a commit that referenced this pull request Sep 23, 2024
* update cli support for dataconnect toolkit and webhooks (#7635)

* update cli support for toolkit and webhooks

* update ports

* update ports

* Replace any with Options

* update exec to call webhook, format

* address comment

* address comment

* remove unused var

---------

Co-authored-by: joehan <joehanley@google.com>

* Emulator start refactor (#7638)

* update cli support for toolkit and webhooks

* update ports

* update ports

* Replace any with Options

* update exec to call webhook, format

* address comment

* address comment

* remove unused var

* vscode implementation of emulator start

* delete debug log

* address comments

---------

Co-authored-by: joehan <joehanley@google.com>

* DataConnect + PGLite prototype. (#7615)

* Hacking away at pglite+dataconnect emulator

* Hacking away at it

* More debugging

* I THINK IT WORKSSSSS

* Saving my progress at EoD

* --amend

* Progress

* clean up

* formatting

* Use extended query patch (thanks @gregnr!)

* Format and merge master

* PR fixes

* Remove JSON comments

* format

* Fxing test compilation issues

* Cleaning up build issues

* PR fixes

* Format and generate json schema

* Patching in missing types for VSCode builds

* More type fixing

* More type fixing

* Little bit mroe code review

* Removed unused dep

* More pr fixes

* test:emualtors build fixed

* PR fixes

* Fix port disagreement

* Fix webhook; Clean up emulator code (#7649)

* fix webhooks and cleanup old emulator code

* await sendVSCode completion

* Also handle extended query protocol for close messages (#7653)

* Better handling for invalid JSON variables (#7654)

* Adding a docs link to the sidebar (#7657)

* Clean up code-extension config (#7660)

* Clean up extension configuration

* pulls out messages into i10n/markdown-compatible source

* Simplify the config getter

* Remove errant firebase-path

* Add firebase-path option for vscode (#7662)

* Add firebase-path option for vscode

Allow folks to specify a specific firebase binary

* Update vscode port

* Improved messaging on deploy (#7661)

* Removing LocalConnectionString (#7652)

* cleaning up localconnectionstring

* LocalConnectionString is dead

* test fix

* Good catch

* Enable strict mode (#7663)

* Teardown legacy context provider

* Enable strict mode on the vscode webviews (#7665)

* add await (#7670)

* Rough pass on extension UI (#7668)

* Rough pass on extension UI

* Update docs UI

* Flex the panels to get full-width content

* [𝘀𝗽𝗿] initial version (#7676)

Created using spr 1.3.6-beta.1

* Round 1 of bug bash fixes (#7667)

* Round 1 of bug bash fixes

* Fixing build issue

* Fix package-lock.json

* Oops

* Use lsofi instead of rolling our own

* format

* Fixing lsofi issues (#7683)

* Reload codelens on emulator status change; Add loading state back for emulators start (#7692)

* Add handling for port conflicts. Add fallback for emulator loading state (#7682)

* Add handling for port conflicts. Add fallback for emulator loading state

* update equality

* address comments

* Set default state for sidebar. Update fallback for emulator start (#7694)

* Set default state for sidebar. Update fallback for emulator start

* address comments

* small text update

* change comment

* Re-fetch the extensions doc link when the app is initialized (#7695)

* Better handling for port conflicts and errors in Data Connect emulator (#7691)

* WIP - better error handlingport conflicts

* Void

* Update src/emulator/storage/rules/runtime.ts

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* Update src/emulator/downloadableEmulators.ts

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* Find open ports

---------

Co-authored-by: Yuchen Shi <yuchenshi@google.com>

* remove debug mode (#7697)

* Add UI polish for running emulator status (#7699)

* update emulator reset text (#7698)

* update emulator reset text

* update text

* update text (#7700)

* update webhook (#7702)

* startup -> start-up (#7701)

* Fix broken logout, and clean up anys (#7714)

* Fix invalid connector path in FDC example (#7709)

* Added dart to firebase CLI (#7569)

---------

Co-authored-by: joehan <joehanley@google.com>
Co-authored-by: TJ Lavelle <tlavelle@google.com>
Co-authored-by: TJ Lavelle <tj@lavelle.io>
Co-authored-by: Yuchen Shi <yuchenshi@google.com>
Co-authored-by: Remi Rousselet <darky12s@gmail.com>
Co-authored-by: Maneesh Tewani <maneesht@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants